package com.google.demo.mvc.action;


import com.google.demo.service.AAA;
import com.google.demo.service.IDemoService;
import com.google.mvcframework.annotation.KCAutowired;
import com.google.mvcframework.annotation.KCController;
import com.google.mvcframework.annotation.KCRequestMapping;
import com.google.mvcframework.annotation.KCRequestParam;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@KCController
@KCRequestMapping("/demo")
public class DemoAction {

    @KCAutowired private IDemoService demoService;
    private AAA aaa;


    @KCRequestMapping("/query.json")
    public void query(HttpServletRequest req, HttpServletResponse resp,
                      @KCRequestParam("name") String name){
        String result=demoService.get(name);
        try{
            resp.getWriter().write(result);
        }catch (IOException e){
            e.printStackTrace();
        }
    }
    @KCRequestMapping("/edit.json")
    public void edit(HttpServletRequest req,HttpServletResponse resp,Integer id){

    }

    @KCRequestMapping("/remove.json")
    public void remove(HttpServletRequest req,HttpServletResponse resp,Integer id){

    }
}
